# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-07-10
# @File : 3_complete_cellPhone.py

import rsa
import base64


phone = "18378353331"

pub_key_str = '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9G4LU8LZtxApKhP81Usk7ze7obk8osQQcHhVdEfVoVIL3PTd2oIknWBBdIQz/r7HCVeZr6kMaESFc6dpmLime06JWyg902I0S+e8UnAaXhIQJso4wBVD4KtRKozCZ4XzFg8xK40/jO3rJA7WU7Tsn2qcr+MYyqLnN31umo3zZZwIDAQAB\n-----END PUBLIC KEY-----\n'
key = rsa.PublicKey.load_pkcs1_openssl_pem(pub_key_str.encode('utf-8'))
rsa_bytes = rsa.encrypt(phone.encode(encoding='utf-8'), key)

b64_bytes = base64.b64encode(rsa_bytes)
data = b64_bytes.decode('utf-8')

print(data)